package com.supermarket.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 日志配置类
 */
@Configuration
public class LoggingConfig {

    /**
     * 日志配置属性
     */
    @Component
    @ConfigurationProperties(prefix = "logging.request")
    public static class LoggingProperties {
        /**
         * 是否启用请求日志
         */
        private boolean enabled = true;
        
        /**
         * 是否记录请求头
         */
        private boolean includeHeaders = true;
        
        /**
         * 是否记录请求参数
         */
        private boolean includeQueryParams = true;
        
        /**
         * 是否记录请求体
         */
        private boolean includePayload = true;
        
        /**
         * 最大请求体大小
         */
        private int maxPayloadLength = 10000;

        public boolean isEnabled() {
            return enabled;
        }

        public void setEnabled(boolean enabled) {
            this.enabled = enabled;
        }

        public boolean isIncludeHeaders() {
            return includeHeaders;
        }

        public void setIncludeHeaders(boolean includeHeaders) {
            this.includeHeaders = includeHeaders;
        }

        public boolean isIncludeQueryParams() {
            return includeQueryParams;
        }

        public void setIncludeQueryParams(boolean includeQueryParams) {
            this.includeQueryParams = includeQueryParams;
        }

        public boolean isIncludePayload() {
            return includePayload;
        }

        public void setIncludePayload(boolean includePayload) {
            this.includePayload = includePayload;
        }

        public int getMaxPayloadLength() {
            return maxPayloadLength;
        }

        public void setMaxPayloadLength(int maxPayloadLength) {
            this.maxPayloadLength = maxPayloadLength;
        }
    }
} 